<template>
  <vxe-table :data="tableData" stripe border align="center" height="100%" auto-resize>
    <vxe-column type="seq" title="序号" width="60"></vxe-column>

    <vxe-column field="registerNumber" title="注册号/统一社会信用代码" min-width="220"></vxe-column>
    <vxe-column field="enterpriseName" title="企业名称" min-width="200"></vxe-column>
    <vxe-column field="enterpriseType" title="企业规模类型" min-width="120"></vxe-column>
    <vxe-column field="legalPerson" title="法定代表人" min-width="120"></vxe-column>
    <vxe-column field="registerCapital" title="注册资本（万元）" min-width="130"></vxe-column>
    <vxe-column field="establishDate" title="成立日期" width="150"></vxe-column>
    <vxe-column field="employee" title="员工数量" width="100"></vxe-column>
    <vxe-column field="enterpriseAddress" title="地址" min-width="200"></vxe-column>
    <vxe-column title="操作" fixed="right" width="130" #default="{ row, rowIndex }">
      <el-button @click.native.prevent="onClick('view', row)" type="text">查看</el-button>
      <el-button v-if="isOper" @click.native.prevent="onClick('addEdit', row)" type="text">修改</el-button>
      <el-button v-if="isOper" class="delete-btn" type="text" @click="onClick('delete', row, rowIndex)">删除</el-button>
    </vxe-column>
  </vxe-table>
</template>
<script>
export default {
  name: 'TableData',
  components: {},
  props: {
    tableData: {
      type: Array,
    },
    // 是否可以操作
    isOper: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    onClick(eventName, row, rowIndex) {
      this.$emit('tableBtnClick', { eventName: eventName, ...row, rowIndex: rowIndex })
    },
  },
}
</script>
<style lang="scss" scoped>
.delete-btn {
  color: #fc6969;
}
::v-deep(.vxe-table--body-wrapper .vxe-cell) {
  font-family: 'syht-Regular';
  font-weight: 400;
  font-size: 14px;
}
</style>
